package unit4.part1;

/**
 * 4.1.4.成员变量
 */
public class VarTest {
    public static void main(String[] args) {
        Count countA = new Count();
        System.out.println(countA.serialNumber + "," + Count.counter);
        Count countB = new Count();
        System.out.println(countA.serialNumber + "," + Count.counter);
        System.out.println(countB.serialNumber + "," + Count.counter);
    }
}

class Count {
    public int serialNumber;// 对象序列号，实例属性
    public static int counter = 0;// 对象计数器，静态属性

    public Count() {
        counter++;
        serialNumber = counter;
    }
}
